<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
    <xsl:key name="person" match="/nagrody_turinga/naukowcy/naukowiec" use="@id"/>
    <xsl:template match="/nagrody_turinga">
        <feed xmlns="http://www.w3.org/2005/Atom">
            <updated>
                <xsl:value-of select="current-dateTime()"/>
            </updated>
            <title>Zdobywcy nagrody TURINGA (LOEBNERA)</title>
            <author>
                <name>Łukasz Kozerski</name>
            </author>
            <id>urn:uuid:<xsl:value-of select="generate-id()"/></id>
            <xsl:for-each select="nagrody/nagroda">
                <xsl:variable name="rok" select="@rok"/>
                <entry>
                    <author>
                        <name>Łukasz Kozerski</name>
                    </author>
                    <id>urn:uuid:<xsl:value-of select="generate-id()"/></id>
                    <title>Rok <xsl:value-of select="@rok"/>. Nagrodzeni:</title>
                    <updated>
                        <xsl:value-of select="current-dateTime()"/>
                    </updated>
                    <link href="kozerski.hmtl#r"/>
                    <summary>
                        <xsl:for-each select="nagrodzony/key('person', @id_naukowca)">
                            <xsl:for-each select="imie">
                                <xsl:value-of select="."/>
                                <xsl:text> </xsl:text>
                            </xsl:for-each>
                            <xsl:value-of select="nazwisko"/>
                            <xsl:text>, </xsl:text>
                        </xsl:for-each>
                    </summary>
                </entry>
            </xsl:for-each>
        </feed>
    </xsl:template>
</xsl:stylesheet>
